/**
 * Created by WLG on 2018/11/27.
 */
// 引入obs库
let ObsClient = require('./hwobs/obs');
let ServerConfig = require('../config/serverConfig');

// 创建ObsClient实例

let client = null;

class ObsManager{
    static init(){
        this.createClient();
    }
    static getClient(){
        if(client === null){
            client = this.createClient();
        }
        return client;
    }
    static createClient(){
        commonUtil.consoleSysInfo("OBS创建Client");
        client = new ObsClient(ServerConfig.obsConfig.clientConfig);
        commonUtil.consoleSysInfo("OBS初始化日志");
        client.initLog({
            name: 'HW_OBS_LOG', // 日志名称
            file_full_path:'./logs/hw-obs.log', // 配置日志文件路径
            max_log_size:20480, // 配置日志文件大小，单位：字节
            backups:10, // 配置最大可保留的日志文件个数
            level:'error', // 配置日志级别
            log_to_console:true // 配置是否将日志打印到console
        });
    }
}
// 使用访问OBS

// 关闭obsClient
//client.close();
module.exports = ObsManager;